@function val($key) {
  @return map-get($map: $root, $key: $key)
}

$global-fz: .16rem;

$global-color-types:gray, light-gray, danger, primary;

$global-zlevel: 100,200,300,400,500,600,700,800,900;

$root: (
  --color-gray: #949494,
  --color-light-gray: #f4f4f4,
  --color-danger: #FF3333,
  --color-primary: #494FF5,
  --color-success: #28a745,
  --color-gray-400: #D9D9D9,
  --color-gray-500: #EBEBEB,
);

@each $v in $global-color-types {
  $key: "--text-color-" + $v;
  $value: val("--color-" + $v);
  $root: map-merge($root, ( #{$key}: #{$value}))
}

@each $v in $global-color-types {
  $key: "--bg-color-" + $v;
  $value: val("--color-" + $v);
  $root: map-merge($root, ( #{$key}: #{$value}))
}

@mixin common-init($sel: ":root") {
  #{$sel} {
    @each $k,$v in $root {
      #{$k}: #{$v};
    }
  }
}

